import { _decorator, AudioClip, Component, easing, find, Label, Node, Prefab, tween, v2, v3, Vec2 } from 'cc';
import { SSS_Consts } from "../../../../../../../Script/Data/SSS_Consts";
import { bdlMgr } from "../../../../../../../Script/Manager/BundleManager_S";
import ChengYu_CardFunctions from "../Common/ChengYu_CardFunctions";
import ChengYu_GameFunctions from "../Common/ChengYu_GameFunctions";
import ChengYu_GameConfig from "../Data/ChengYu_GameConfig";
import { ChengYu_GameData } from "../Data/ChengYu_GameData";
import XXL_Grid from "../Game/XXL_Grid";
import ChengYu_CommonFunction from "../Utils/ChengYu_CommonFunction";
import ChengYu_GamePanel from "./ChengYu_GamePanel";
import ChengYu_Main from '../Manager/ChengYu_Main';
import { SSS_AudioManager } from 'db://assets/Script/Manager/SSS_AudioManager';
const { ccclass, property } = _decorator;

// /** 1-接龙 */

@ccclass('ChengYuGamePanel1')
export default class ChengYu_GamePanel_1 extends Component {
        static Instance: ChengYu_GamePanel_1;
        @property(Node)
        Root: Node | null = null;
        @property(Node)
        main: Node | null = null;
        @property(Prefab)
        Prefab_Grid: Prefab | null = null;
        @property(Node)
        answer: Node | null = null;

        idiomList: any[] = [];
        answerList: any[] = [];
        index_select: number = 0;
        data_list: any = [];
        data11: any;
        array_all: any;
        answerWord = [];

        onLoad() {
                ChengYu_GamePanel_1.Instance = this;

                console.log(`ChengYu_GamePanel_1.onLoad`);
        }
        ShowOn() {
                if (this.node) {
                        this.node.active = true;
                        this.Init();
                        this.AddListener();
                        this.Refresh();
                }
        }
        //    // answer: (3)[(1, 5, 6)];
        //    // barrier: [];
        //    // hard_idioms: [Array(1)];
        //    // id: 2;
        //    // idiom: (3)[("福星高照", "众星拱月", "花好月圆")];
        //    // posx: (10)[(2, 1, 2, 3, 4, 2, 0, 1, 2, 3)];
        //    // posy: (10)[(3, 2, 2, 2, 2, 1, 0, 0, 0, 0)];
        //    // word: (10)[("众", "福", "星", "高", "照", "拱", "花", "好", "月", "圆")];
        InitData() {
                const idiom_list = ChengYu_GameData.GameData.LevelData.idiom;
                let word_list = ChengYu_GameData.GameData.LevelData.word;
                const posx_list = ChengYu_GameData.GameData.LevelData.posx;
                const posy_list = ChengYu_GameData.GameData.LevelData.posy;

                for (let index = 0; index < ChengYu_GameData.GameData.LevelData.answer.length; index++) {
                        const element = ChengYu_GameData.GameData.LevelData.answer[index];
                        // console.log(`element`, element);

                        const word = word_list[element];
                        // console.log(`word`, word);

                        this.answerWord.push(word);
                }
                // console.log(`this.answerWord`, this.answerWord);

                let arr = [];
                for (let index = 0; index < idiom_list.length; index++) {
                        arr[index] = [];
                        const idiom = idiom_list[index];

                        for (let index2 = 0; index2 < idiom.length; index2++) {
                                const word1 = idiom[index2];
                                for (let index3 = 0; index3 < word_list.length; index3++) {
                                        const word2 = word_list[index3];
                                        if (word1 === word2) {
                                                // word_list[index3] = "";
                                                const x = posx_list[index3];
                                                const y = posy_list[index3];
                                                let item = { pos: v2(x, y), word: word1 };
                                                arr[index].push(item);
                                                break;
                                        }
                                }
                        }
                }

                this.array_all = arr;

                // console.log(`arr---123----`, arr);
        }
        GetNewList() {
                const idiom_list = ChengYu_GameData.GameData.LevelData.idiom;
                const word_list = ChengYu_GameData.GameData.LevelData.word;
                const posx_list = ChengYu_GameData.GameData.LevelData.posx;
                const posy_list = ChengYu_GameData.GameData.LevelData.posy;

                const new_list = [];
                for (let index = 0; index < word_list.length; index++) {
                        const word2 = word_list[index];
                        const x = posx_list[index];
                        const y = posy_list[index];
                        new_list[index] = { x: x, y: y, word: word2 };
                }

                return new_list;
        }
        GetArray() {
                let new_list = this.GetNewList();

                let arrA = [];
                for (let x = 0; x < ChengYu_GameConfig.col; x++) {
                        arrA[x] = [];
                        for (let y = 0; y < ChengYu_GameConfig.row; y++) {
                                let arr = new_list.filter((item) => {
                                        return item.x == x && item.y == y;
                                });
                                // console.log(`arr[0];`, arr[0]);

                                arrA[x][y] = arr[0];
                        }
                }

                return arrA;
        }
        //    // 横向
        GetAll3ArrayX() {
                let arr = [];
                let tempArray = [];
                let fun = () => {
                        if (tempArray.length >= 4) {
                                let data = tempArray;
                                arr.push(data);
                        }
                        tempArray = [];
                };

                let arrA = this.GetArray();

                for (let y = 0; y < ChengYu_GameConfig.row; y++) {
                        fun();
                        for (let x = 0; x < ChengYu_GameConfig.col; x++) {
                                const scrCard = arrA[x][y];

                                if (scrCard) {
                                        if (!tempArray[tempArray.length - 1]) {
                                                tempArray.push(scrCard);
                                        } else {
                                                tempArray.push(scrCard);
                                        }

                                        if (x === ChengYu_GameConfig.col - 1 && y === ChengYu_GameConfig.row - 1) {
                                                fun();
                                        }
                                } else {
                                        fun();
                                }
                        }
                }

                return arr;
        }
        //    // 纵向
        GetAll3ArrayY() {
                let arr = [];
                let tempArray = [];
                let fun = () => {
                        if (tempArray.length >= 4) {
                                let data = tempArray;
                                arr.push(data);
                        }
                        tempArray = [];
                };

                let arrA = this.GetArray();

                for (let x = 0; x < ChengYu_GameConfig.col; x++) {
                        fun();
                        for (let y = ChengYu_GameConfig.row - 1; y >= 0; y--) {
                                const scrCard = arrA[x][y];

                                if (scrCard) {
                                        if (!tempArray[tempArray.length - 1]) {
                                                tempArray.push(scrCard);
                                        } else {
                                                tempArray.push(scrCard);
                                        }

                                        if (x === ChengYu_GameConfig.col - 1 && y === ChengYu_GameConfig.row - 1) {
                                                fun();
                                        }
                                } else {
                                        fun();
                                }
                        }
                }

                return arr;
        }
        //    /**
        //     * 获取普通消除数据
        //     */
        GetAll3XY() {
                const arrX = this.GetAll3ArrayX();
                const arrY = this.GetAll3ArrayY();

                let array_all: any = arrX.concat(arrY);

                // console.log(`array_all`, array_all);

                return array_all;
        }
        GetSelectGroup(pos_select: Vec2) {
                let arr = [];

                // console.log(`选中pos`, pos_select);

                let arrayAll = this.GetAll3XY();

                for (let index = 0; index < arrayAll.length; index++) {
                        const group = arrayAll[index];
                        for (let index2 = 0; index2 < group.length; index2++) {
                                const pos = group[index2];
                                if (pos_select.equals(pos)) {
                                        arr.push(group);
                                        break;
                                }
                        }
                }

                // console.log(`选中组`, arr);

                return arr;
        }
        GetSelectGroupTween(group, callback: Function = null) {
                for (let index = 0; index < group.length; index++) {
                        const element = group[index];

                        let isAllRight: boolean = true;
                        for (let index2 = 0; index2 < element.length; index2++) {
                                const pos = element[index2];
                                const grid: XXL_Grid = ChengYu_GameData.arrGrids[pos.x][pos.y];
                                if (grid.word_right !== grid.word_current) {
                                        isAllRight = false;
                                }
                        }

                        let count = element.length;
                        if (isAllRight) {
                                for (let index2 = 0; index2 < element.length; index2++) {
                                        const pos = element[index2];
                                        const grid: XXL_Grid = ChengYu_GameData.arrGrids[pos.x][pos.y];
                                        let tween1 = tween(grid.node)
                                                .delay(index2 * 0.15)
                                                .call(() => {
                                                        grid.isComplete = true;
                                                        grid.Refresh();
                                                })

                                                // .to(0.2, { scale: v3(1.4, 1.4, 1.4) }, { easing: "sineOut" })
                                                // .to(0.3, { scale: v3(1, 1, 1) }, { easing: "sineInOut" })
                                                .to(0.2, { scale: v3(1.4, 1.4, 1.4) }, { easing: easing.sineOut })
                                                .to(0.3, { scale: v3(1, 1, 1) }, { easing: easing.sineInOut })


                                                .call(() => {
                                                        count--;
                                                        if (count <= 0) {
                                                                if (callback) {
                                                                        callback();
                                                                }
                                                        }
                                                })
                                                .start();
                                }
                        }
                }
        }
        GetAround4(x, y) {
                let array = [];

                let up = ChengYu_CardFunctions.GetGrid(x, y + 1);
                let down = ChengYu_CardFunctions.GetGrid(x, y - 1);
                let left = ChengYu_CardFunctions.GetGrid(x - 1, y);
                let right = ChengYu_CardFunctions.GetGrid(x + 1, y);

                if (!up || up.node.active === false) {
                        array.push(v2(0, 1));
                }
                if (!down || down.node.active === false) {
                        array.push(v2(0, -1));
                }
                if (!left || left.node.active === false) {
                        array.push(v2(-1, 0));
                }
                if (!right || right.node.active === false) {
                        array.push(v2(1, 0));
                }

                // console.log(`array---`, array);

                if (array.length === 0) {
                        array.push(v2(0, -1));
                }

                return array;
        }
        Init() {
                // ChengYu_GamePanel.Instance.bg_meihua.active = true;

                this.InitData();

                // let getX = this.GetX();
                // let getY = this.GetY();

                this.idiomList = [];
                this.answerList = [];

                ChengYu_GamePanel_1.Instance.main.parent = ChengYu_GamePanel.Instance.bg_main;
                ChengYu_GamePanel_1.Instance.main.position = v3(0, 0, 0);
                ChengYu_GamePanel_1.Instance.main.destroyAllChildren();

                ChengYu_GameData.arrGrids.length = 0;

                // 格子
                for (let x = 0; x < ChengYu_GameConfig.col; x++) {
                        ChengYu_GameData.arrGrids[x] = [];
                        for (let y = 0; y < ChengYu_GameConfig.row; y++) {
                                const id = 1;
                                const grid: XXL_Grid = ChengYu_CardFunctions.CreateGrid(id, x, y);
                                grid.node.active = false;
                                ChengYu_GameData.arrGrids[x][y] = grid;
                                grid.Refresh();
                        }
                }

                // 上面的字
                for (let index = 0; index < ChengYu_GameData.GameData.LevelData.word.length; index++) {
                        const str = ChengYu_GameData.GameData.LevelData.word[index];
                        const x = ChengYu_GameData.GameData.LevelData.posx[index];
                        const y = ChengYu_GameData.GameData.LevelData.posy[index];
                        const grid: XXL_Grid = ChengYu_GameData.arrGrids[x][y];
                        grid.node.active = true;
                        grid.isActive = false;
                        grid.word_right = str;
                        grid.word_current = str;
                        grid.Label_word.string = str;
                        grid.Refresh();
                }

                // 答案
                ChengYu_CommonFunction.SetAllChildrenAtive(this.answer, false);
                for (let index = 0; index < ChengYu_GameData.GameData.LevelData.answer.length; index++) {
                        // 上面的字-答案
                        const index_answer = ChengYu_GameData.GameData.LevelData.answer[index];
                        const x = ChengYu_GameData.GameData.LevelData.posx[index_answer];
                        const y = ChengYu_GameData.GameData.LevelData.posy[index_answer];
                        const grid: XXL_Grid = ChengYu_GameData.arrGrids[x][y];
                        grid.Label_word.node.active = false;

                        grid.isActive = true;
                        grid.isFill = false;
                        grid.isRight = false;
                        grid.word_current = "";
                        grid.Refresh();

                        // grid.Label_index.node.active = true;
                        // grid.Label_index.string = `${index}`;

                        this.idiomList.push(grid);

                        grid.node.on(
                                Node.EventType.TOUCH_START,
                                () => {
                                        // console.log(grid.x, grid.y);

                                        if (ChengYu_GameData.GameData.IsGameEnd === true) {
                                                return;
                                        }
                                        if (grid.word_right === grid.word_current) {
                                                return;
                                        }

                                        // console.log(grid.x, grid.y, grid.word_right);

                                        this.index_select = index;

                                        let data: any = {};

                                        for (let index_t = 0; index_t < this.data_list.length; index_t++) {
                                                const element = this.data_list[index_t];
                                                if (index === element.index_2) {
                                                        data = element;
                                                        break;
                                                }
                                        }

                                        grid.isFill = false;
                                        grid.word_current = "";
                                        grid.Refresh();
                                        data.index_2 = -1;
                                        data.word = "";

                                        this.Refresh();
                                },
                                this
                        );

                        // 下面的字-答案
                        let node = ChengYu_CommonFunction.GetFreeChild(this.answer);
                        node.active = true;
                        const word_str: string = ChengYu_GameData.GameData.LevelData.word[index_answer];
                        const Label_word: Label = find("Label_word", node).getComponent(Label);
                        Label_word.string = word_str;
                        this.answerList.push(node);

                        node.on(
                                Node.EventType.TOUCH_START,
                                () => {
                                        this.ClickAnswer(index);
                                },
                                this
                        );

                        this.data_list.push({
                                index_1: index,
                                index_2: -1,
                                word: "",
                        });
                }

                if (ChengYu_GameData.GameData.IsGridHongBaoState === true) {
                        // ChengYu_GamePanel.Instance.Grid_HongBao.active = true;
                        let grid_2: XXL_Grid = this.idiomList[0];
                        // ChengYu_GamePanel.Instance.Grid_HongBao.parent = grid_2.node.parent;
                        // ChengYu_GamePanel.Instance.Grid_HongBao.position = grid_2.node.position;
                } else {
                        // ChengYu_GamePanel.Instance.Grid_HongBao.active = false;
                }

                // if (UserManger.getInstance().getUserInfo().getNoviceGuideStep() === 0 && UserManger.getInstance().getUserInfo().getCurLevel() === 0) {
                //     // hallFunc.showPanel(HallResConstant.PREFABS_PATH.StartAnswerGuide_KanTuCaiCi);
                // } else {
                // // 打乱顺序
                ChengYu_GameFunctions.DisorderChildren(ChengYu_GamePanel_1.Instance.answer);
                // }
        }
        ClickAnswer(index) {
                if (ChengYu_GameData.GameData.IsGameEnd === true) {
                        return;
                }

                if (this.data_list[index].index_2 >= 0) {
                        // console.log(`答案已经在上面了`);
                        return;
                }

                const index_answer = ChengYu_GameData.GameData.LevelData.answer[index];
                const word_str: string = ChengYu_GameData.GameData.LevelData.word[index_answer];
                // console.log(`index`, index, word_str);

                let data = this.data_list[index];
                data.index_2 = this.index_select;
                data.word = word_str;

                let grid_1: XXL_Grid = this.idiomList[this.index_select];
                grid_1.isFill = true;
                grid_1.word_current = word_str;
                grid_1.Refresh();

                let grid_2: XXL_Grid = this.idiomList[0];

                // let name = `tile click blocked`;
                let name = `game_button_click`;
                let audio_root = `audio/${name}`;
                bdlMgr.getRes<AudioClip>(SSS_Consts.BundleName.AUDIO, audio_root, AudioClip).then(res => {
                        SSS_AudioManager.Instance.playSFX(res, false);
                });

                if (grid_1.word_current === grid_1.word_right) {
                        // AudioPlayer.getInstance().playSound("music/right", false, hallFunc.xwResBundle);



                        let check = this.Check();
                        if (check) {
                                this.DisableSelect();
                        }

                        let callbackWin = () => {
                                // console.log(`callbackWin------`, callbackWin);

                                // if (XXL_GameData.GameData.IsGameEnd) {
                                //     return;
                                // }

                                let check = this.Check();
                                if (check) {
                                        ChengYu_GameData.GameData.IsGameEnd = true;
                                        this.DisableSelect();

                                        // if (UserManger.getInstance().getUserInfo().getNoviceGuideStep() === 0 && UserManger.getInstance().getUserInfo().getCurLevel() === 0) {
                                        //     return;
                                        // }

                                        setTimeout(() => {
                                                ChengYu_Main.Instance.GameWin();
                                        }, 1200);
                                }
                        };

                        // if (grid_1 === grid_2 && XXL_GameData.GameData.IsGridHongBaoState === true && XXL_GameData.GameData.IsGridHongBaoGet === false) {
                        //     this.GridHongBaoMove();
                        //     this.GridHongBaoGet(callbackWin);
                        // } else {
                        callbackWin();
                        // }

                        let group = this.GetSelectGroup(v2(grid_1.x, grid_1.y));
                        this.GetSelectGroupTween(group, null);

                        // console.log(`data`, data);
                } else {
                        // AudioPlayer.getInstance().playSound("music/wrong", false, hallFunc.xwResBundle);

                        // if (grid_1 === grid_2 && XXL_GameData.GameData.IsGridHongBaoState === true && XXL_GameData.GameData.IsGridHongBaoGet === false) {
                        //     this.GridHongBaoMove();
                        // }
                }

                this.NextIndex_1();
                this.Refresh();
        }
        NextIndex_1() {
                let array = this.GetLeftArry();
                if (array.length === 0) {
                        return false;
                }

                const array_up = this.GetArray_up();

                // console.log(`array`, array);

                let element;
                this.index_select++;
                if (this.index_select > array_up.length - 1) {
                        this.index_select = 0;
                }
                element = array_up[this.index_select];

                // console.log(`element`, this.index_select, element);

                while (element.hasWord === true) {
                        this.index_select++;
                        if (this.index_select > array_up.length - 1) {
                                this.index_select = 0;
                        }

                        element = array_up[this.index_select];

                        // console.log(`element`, this.index_select, element);
                }
        }
        //    // GridHongBaoMove() {
        //    //     let grid_2: XXL_Grid = this.idiomList[0];
        //    //     GamePanel.Instance.Grid_HongBao.parent = grid_2.node.parent;
        //    //     GamePanel.Instance.Grid_HongBao.position = grid_2.node.position;
        //    //     console.log(`grid_2`, grid_2.word_current, grid_2.word_right);
        //    //     let around4 = this.GetAround4(grid_2.x, grid_2.y);
        //    //     let around4_1 = around4[0];
        //    //     GamePanel.Instance.Grid_HongBao.x += around4_1.x * XXL_GameConfig.grid_size;
        //    //     GamePanel.Instance.Grid_HongBao.y += around4_1.y * XXL_GameConfig.grid_size;
        //    // }
        //    // // 触发格子红包
        //    // GridHongBaoGet(callback: Function) {
        //    //     if (XXL_GameData.GameData.IsGridHongBaoState !== true) return;
        //    //     if (XXL_GameData.GameData.IsGridHongBaoGet === true) return;
        //    //     XXL_GameData.GameData.IsGridHongBaoGet = true;
        //    //     GamePanel.Instance.Grid_HongBao.active = false;
        //    //     setTimeout(() => {
        //    //         const params = {
        //    //             adMpName2AdMpNameInfAdMpCfg: AdMpName2AdMpNameInfAdMpCfg.gridHongbao,
        //    //             callback: callback,
        //    //         };
        //    //         hallFunc.showPanel(HallResConstant.PREFABS_PATH.HongBaoOpen_WenQuXingPanel, params);
        //    //     }, 600);
        //    // }
        Select() {
                let check = this.Check();
                if (check) {
                        return;
                }

                for (let index = 0; index < this.idiomList.length; index++) {
                        const grid: XXL_Grid = this.idiomList[index];
                        grid.Select(false);
                }
                const grid: XXL_Grid = this.idiomList[this.index_select];
                grid.Select(true);
        }
        DisableSelect() {
                for (let index = 0; index < this.idiomList.length; index++) {
                        const grid: XXL_Grid = this.idiomList[index];
                        grid.Select(false);
                }
        }
        Refresh() {
                for (let index = 0; index < this.data_list.length; index++) {
                        let grid_1: XXL_Grid = this.idiomList[index];
                        grid_1.Label_word.node.active = false;
                }

                for (let index = 0; index < this.data_list.length; index++) {
                        const element = this.data_list[index];

                        let node_2: Node = this.answerList[index];
                        const Label_word_2: Label = find("Label_word", node_2).getComponent(Label);

                        if (element.index_2 < 0) {
                                Label_word_2.node.active = true;
                        } else {
                                Label_word_2.node.active = false;
                                let grid_1: XXL_Grid = this.idiomList[element.index_2];
                                grid_1.Label_word.node.active = true;
                                grid_1.Label_word.string = element.word;
                        }
                }

                this.Select();
        }
        //    // Check() {
        //    //     return false;
        //    //     for (let index = 0; index < this.data_list.length; index++) {
        //    //         const element = this.data_list[index];
        //    //         if (element.index_1 !== element.index_2) {
        //    //             return false;
        //    //         }
        //    //     }
        //    //     return true;
        //    // }
        Check() {
                for (let index = 0; index < this.idiomList.length; index++) {
                        const grid: XXL_Grid = this.idiomList[index];
                        if (grid.word_right !== grid.word_current) {
                                return false;
                        }
                }

                return true;
        }
        //    // 剩余的数组
        GetLeftArry() {
                const array = [];

                for (let index = 0; index < this.data_list.length; index++) {
                        const element = this.data_list[index];
                        if (element.index_2 < 0) {
                                array.push(element);
                        }
                }

                return array;
        }
        //    // 上面的数组
        GetArray_up() {
                const array = [];

                const array_up = [];
                const count = this.data_list.length;
                for (let index = 0; index < count; index++) {
                        const element = this.data_list[index];

                        array.push({ index: index, hasWord: false });

                        if (element.index_2 >= 0) {
                                array_up.push(element.index_2);
                        }
                }

                for (let index = 0; index < array_up.length; index++) {
                        const id33 = array_up[index];
                        array[id33].hasWord = true;
                }

                // console.log(`GetArry_up`, array);

                return array;
        }
        ShowOff() {
                this.node.active = false;
                this.RemoveListener();
        }
        AddListener() { }
        RemoveListener() { }
        AutoAnswer() {
                this.DisableSelect();

                // console.log(`自动答题-1`);
                if (ChengYu_GameData.GameData.IsGameEnd) {
                        return;
                }

                ChengYu_GameData.GameData.IsGameEnd = true;

                let callback = () => {
                        setTimeout(() => {
                                ChengYu_Main.Instance.GameWin();
                        }, 500);
                };

                // if (XXL_GameData.GameData.IsGridHongBaoState === true && XXL_GameData.GameData.IsGridHongBaoGet === false) {
                //     this.GridHongBaoMove();
                //     this.AllAnimation(() => {
                //         this.GridHongBaoGet(callback);
                //     });
                // } else {
                this.AllAnimation(callback);
                // }
        }
        AllAnimation(callback: Function) {
                let count = this.idiomList.length;
                for (let index4 = 0; index4 < this.idiomList.length; index4++) {
                        let grid_1: XXL_Grid = this.idiomList[index4];
                        grid_1.word_current = grid_1.word_right;
                        const Label_word_1: Label = find("Label_word", grid_1.node).getComponent(Label);
                        Label_word_1.node.active = true;
                        grid_1.isActive = true;
                        grid_1.isFill = true;
                        grid_1.Refresh();

                        let group = this.GetSelectGroup(v2(grid_1.x, grid_1.y));
                        this.GetSelectGroupTween(group);

                        for (let index = 0; index < group.length; index++) {
                                const element = group[index];
                                for (let index2 = 0; index2 < element.length; index2++) {
                                        const pos = element[index2];
                                        const grid: XXL_Grid = ChengYu_GameData.arrGrids[pos.x][pos.y];
                                        let tween1 = tween(grid.node)
                                                .delay(index2 * 0.15)
                                                .call(() => {
                                                        grid.isComplete = true;
                                                        grid.Refresh();
                                                })
                                                // .to(0.2, { scale: v3(1.4, 1.4, 1.4) }, { easing: "sineOut" })
                                                // .to(0.3, { scale: v3(1, 1, 1) }, { easing: "sineInOut" })
                                                .to(0.2, { scale: v3(1.4, 1.4, 1.4) }, { easing: easing.sineOut })
                                                .to(0.3, { scale: v3(1, 1, 1) }, { easing: easing.sineInOut })
                                                .call(() => {
                                                        count--;
                                                        if (count === 0) {
                                                                // console.log(123);
                                                                if (callback) {
                                                                        callback();
                                                                }
                                                        }
                                                })
                                                .start();
                                }
                        }
                }
        }
}

// /** 调试 */
window["ChengYu_GamePanel_1"] = ChengYu_GamePanel_1;